package com.example.design.strategy;

/**
 * 环境角色类
 */
public class Context {
    /** 持有一个具体策略的对象 */
    private PriceStrategy priceStrategy;
    /**
     * 构造函数，传入一个具体策略对象
     * @param priceStrategy    具体策略对象
     */
    public Context(PriceStrategy priceStrategy) {
        this.priceStrategy = priceStrategy;
    }

    /**
     * 策略方法
     */
    public void coutPrice(){
        priceStrategy.discount();
    }
}
